package com.bing.habit.service.impl;

import com.bing.habit.mapper.HabitIconDAO;
import com.bing.habit.entity.HabitIcon;
import com.bing.habit.service.HabitIconService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@Service
public class HabitIconServiceImpl implements HabitIconService {
    @Autowired
    HabitIconDAO habitIconDAO;

    public void addOrUpdate(@RequestBody HabitIcon habitIcon) {
        habitIconDAO.insert(habitIcon);
    }

    public void delete(int id) {
        habitIconDAO.deleteById(id);
    }

    public List<HabitIcon> listByCid(int cid) {
        return habitIconDAO.findAllByCid(cid);
    }
}
